-}
{-# LANGUAGE OverloadedStrings #-}
+{-# LANGUAGE CPP #-}
module Annex.Locations (
keyFile,
keyFile :: Key -> OsPath
keyFile k =
let b = serializeKey'' k
- in toOsPath $ if SB.any (`elem` needesc) b
+ in toOsPath $ if anyneedesc b
then mconcat $ map esc (SB.unpack b)
else b
where
needesc = map (fromIntegral . ord) ['&', '%', ':', '/']
+#if MIN_VERSION_bytestring(0,11,3)
+ anyneedesc = SB.any (`elem` needesc)
+#else
+ anyneedesc = any (`elem` needesc) . SB.unpack
+#endif
+
{- Reverses keyFile, converting a filename fragment (ie, the basename of
- the symlink target) into a key. -}
fileKey :: OsPath -> Maybe Key